<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{admin/common/common}">
<head>
    <title>添加内容</title>
</head>

<body layout:fragment="content">

<article class="page-container">
    <form class="form form-horizontal" id="form-content-add">
        <input type="hidden" name="tokenForm" th:value="${#session.getAttribute('tokenForm')}" />

        <input type="hidden" th:name="contentCatId" th:value="${contentCat?.id}"/>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>内容分类：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span th:text="${contentCat?.name}"></span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>内容标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入内容标题" th:id="title" th:name="title"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span>内容子标题：</span></label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入内容子标题" id="subTitle" name="subTitle" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span><span>标题描述：</span></label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="titleDesc" name="titleDesc" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="$.Huitextarealength(this,500)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/500</p>
            </div>
        </div>
        <div class="row cl" id="div_ctime">
            <label class="form-label col-xs-4 col-sm-2"><span id="span_ctime">时间：</span></label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="time" name="time" class="input-text Wdate" style="width:220px;" />
            </div>
        </div>
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>排序值：</label>-->
            <!--<div class="formControls col-xs-8 col-sm-9">-->
                <!--<input type="text" class="input-text" value="0" placeholder="" id="order_number" name="order_number" />-->
            <!--</div>-->
        <!--</div>-->
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span>内容正文：</span></label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea id="content" name="content"></textarea>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span>图片上传：</span></label>
            <div class="formControls col-xs-8 col-sm-9">
                <div class="uploader-thum-container">
                    <div id="fileListPre" class="uploader-list">
                        <img th:src="@{/h-ui/lib/webuploader/0.1.5/images/image.png}" height="81" width="81"/>
                    </div>
                    <div id="filePicker">选择图片</div>
                    <!--<button id="btn-star" class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>-->
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交</button>
                <!-- 				<button onClick="article_save();" class="btn btn-secondary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存草稿</button> -->
                <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</article>

<script type="text/javascript" charset="utf-8" th:src="@{/h-ui/lib/kindeditor-4.1.7/kindeditor-min.js}"></script>
<script type="text/javascript" charset="utf-8" th:src="@{/h-ui/lib/kindeditor-4.1.7/lang/zh_CN.js}"></script>
<script type="text/javascript" th:src="@{/js/admin/content/content-add.js}"></script>
<script th:inline="javascript">

    //富文本kindeditor初始化
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('#content', {
            cssPath :"@{/h-ui/lib/kindeditor-4.1.7/plugins/code/prettify.css}",
            uploadJson : '/upload/kindeditorimage',
            allowFileManager : true,
            allowUpload: true,
            width:"900px",
            height:"350px",
            afterBlur: function(){this.sync();}
        });
    });


    // 初始化头像上传
    var options = {
        uploadBtnId: '#filePicker',
        picturePreId: 'fileListPre',
        hiddenPictureUrl: 'img',
        hiddenPictureName: 'imgName',
        accept : {
            title : 'Images',
            extensions : 'gif,jpg,jpeg,bmp,png',
            mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png'
        },
        width: 81,
        height: 81,
        fileSizeLimit: 100 * 1024 * 1024,
        fileSingleSizeLimit: 2 * 1024 * 1024
//		fileNumLimit: 1
    };

    var webUploadPicture = new $WebUploadPicture(options);
    webUploadPicture.init();


//    //附件上传
//    var options = {
//        uploadBtnId: '#filePicker',
//        docPreId: 'fileListPre',
//        hiddenDocUrl: 'docUrl',
//        hiddenDocName: 'docName',
//        accept : {
//            title : 'Files',
//            extensions : 'doc,ppt,pdf,xls,xlsx',
//            mimeTypes : 'application/msword,application/vnd.ms-powerpoint,application/pdf,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
//        },
//        append: true,
//        fileSizeLimit: 100 * 1024 * 1024,
//        fileSingleSizeLimit: 50 * 1024 * 1024
////		fileNumLimit: 1
//    };
//
//    var webUploadDoc = new $WebUploadDoc(options);
//    webUploadDoc.init();


    /**
     * 取消
     */
    function removeIframe(){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
</body>
</html>